package com.andy.customerService.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截web请求
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    //重写拦截器方法
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor())
                //拦截全部
                .addPathPatterns("/**")
//                .excludePathPatterns("/error")
//                .excludePathPatterns("/admin/getCookie")
                //放行登录请求
                .excludePathPatterns("/admin/login")
//                .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**")
                ;
    }
}
